home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / tclib20.zip / MENUHK.H < prev    next >
C/C++ Source or Header  |  1988-12-03  |  11KB  |  162 lines

  1. /* TCHK 2.0 - Howard Kapustein's Turbo C library       12-3-88 */
  2. /* Copyright (C) 1988, Howard Kapustein.  All rights reserved. */
  3.  
  4. /* menuhk.h  -  header file for menu routines */
  5.  
  6. #ifndef MENUHK_HEADER
  7. #define MENUHK_HEADER   1
  8.  
  9. #include <howard.h>
  10. #include <video.h>
  11.  
  12. #ifndef MENUHK_DEFINES
  13.  
  14. typedef struct popup_field {        /* doubly circular linked list */
  15.                 char *command;          /* ptr to command text (string) */
  16.                 int y;                  /* y-coord of command on screen */
  17.                 char flag;              /* flags, i.e. Disabled, etc. */
  18.                 char key;               /* 1-touch key */
  19.                 char offset;            /* offset of key in string */
  20.                 int retval;             /* value returned when selected ( != 0 ) */
  21.                 struct popup_header *submenu;   /* submenu (used in hierarchial menus) */
  22.                 struct popup_field *next;       /* next item in list */
  23.                 struct popup_field *previous;   /* previous item in list */
  24.             };
  25.  
  26. typedef struct popup_header {
  27.                 char *videosave;                /* ptr to saved video buffer */
  28.                 struct text_info inforec;       /* saved video info */
  29.                 int left, top, right, bottom;   /* menu coordinates */
  30.                 int margc;                      /* menu arguments */
  31.                 struct popup_field *margv;      /* ptr to list of menu args (commands) */
  32.                 struct popup_field *current;    /* current item hilited */
  33.                 char *menusave;                 /* ptr to menu video buffer */
  34.                 int colnorm;                    /* Colors:     normal */
  35.                 int colcmdkey;                              /* 1-touch command key */
  36.                 int colhilite;                              /* hilited/selected item */
  37.                 int coldisabled;                            /* disabled command */
  38.                 int coldishilite;                           /* hilited disabled item */
  39.                 unsigned flags;                 /* Flags: QEFxxxxH = Quit, ESC equals Quit, Free memory on quit, Hierarchial */
  40.                                                 /*        xxIRCEDW = case Independent for 1-touch keys, Restore cursor before */
  41.                                                 /*                   return don't hide Cursor, Erase menu on cleanup/free, */
  42.                                                 /*                   Disabled off (are valid choices), Wraparound */
  43.                 char internal;                  /* Internal flags: xxxxxxx1 = 1st time */
  44.             };
  45.  
  46. typedef struct litebar_field {      /* doubly circular linked list (w/4-way directional) */
  47.                 char *command;          /* ptr to command text (string) */
  48.                 int x, y;               /* x/y-coord of command on screen (rel to litebar window) */
  49.                 char flag;              /* flags, i.e. Disabled, etc. */
  50.                 char key;               /* 1-touch key */
  51.                 char offset;            /* offset of key in string */
  52.                 char *message;          /* ptr to message text (string) */
  53.                 int retval;             /* value returned when selected ( != 0 ) */
  54.                 struct litebar_header *submenu;   /* submenu (used in hierarchial menus) */
  55.                 struct litebar_field *next;       /* next field */
  56.                 struct litebar_field *previous;   /* previous field */
  57.                 struct litebar_field *left;       /* left item in menu (left arrow) */
  58.                 struct litebar_field *right;      /* right item in menu (right arrow) */
  59.                 struct litebar_field *up;         /* up item in menu (up arrow) */
  60.                 struct litebar_field *down;       /* down item in menu (down arrow) */
  61.             };
  62.  
  63. typedef struct litebar_header {
  64.                 char *videosave;                /* ptr to saved video buffer */
  65.                 struct text_info inforec;       /* saved video info */
  66.                 int left, top, right, bottom;   /* litebar coordinates */
  67.                 int margc;                      /* menu arguments */
  68.                 struct litebar_field *margv;    /* ptr to list of menu args (commands) */
  69.                 struct litebar_field *current;  /* current item hilited */
  70.                 int msgx, msgy;                 /* x/y-coord for message */
  71.                 char *menusave;                 /* ptr to menu video buffer */
  72.                 struct keylist *quitkey;        /* Quitkey - leave litebar menu */
  73.                 int colnorm;                    /* Colors:     normal */
  74.                 int colcmdkey;                              /* 1-touch command key */
  75.                 int colhilite;                              /* hilited/selected item */
  76.                 int coldisabled;                            /* disabled command */
  77.                 int coldishilite;                           /* hilited disabled item */
  78.                 int colmessage;                             /* message */
  79.                 unsigned flags;                 /* Flags: QEFxxxxH = = Quit, ESC equals Quit, Free memory on quit, Hierarchial */
  80.                                                 /*        xxIRCEDW = case Independent for 1-touch keys, Restore cursor before return */
  81.                                                 /*                   don't hide Cursor, Erase menu on cleanup/free, Disabled off (are valid choices), Wraparound */
  82.                 char internal;                  /* Internal flags: xxxxxxx1 = 1st time */
  83.             };
  84.  
  85. typedef struct keylist {                    /* linked list of key values (1-512) */
  86.                 int keyval;                     /* key code (1-512) */
  87.                 struct keylist *next;           /* ptr to next key */
  88.             };
  89.  
  90.                                 /* Header flags */
  91. #define QUITMENU        0x8000                /* quit */
  92. #define ESCQUIT         0x4000                /* ESC equals Quit */
  93. #define FREEMENU        0x2000                /* free memory on quit */
  94. #define HIERARCHIAL     0x0100                /* hierarchial menus */
  95. #define CASEINDEP       0x0020                /* case independent 1-touch keys */
  96. #define RESTORECURSOR   0x0010                /* restore cursor before returning */
  97. #define CURSORON        0x0008                /* leave curson on (no hide) */
  98. #define ERASEMENU       0x0004                /* erase menu from screen on cleanup */
  99. #define DISABLEOFF      0x0002                /* disabled off (commands are used) */
  100. #define WRAPAROUND      0x0001                /* wraparound (over top -> bottom) */
  101.  
  102.                                 /* Internal flags (don't muck with these) */
  103. #define FIRSTTIME       0x01                /* first time menutype_get() is called */
  104.  
  105.                                 /* Command (Field) flags */
  106. #define ENABLED         0x00                /* enabled */
  107. #define DISABLED        0x01                /* disabled */
  108. #define NOTOPTION       0x02                /* not an option (static text) */
  109. #define STATICTEXT      NOTOPTION           /* not an option (static text) */
  110. #define MAXMENUCHOICES  23
  111. #define MENUHK_DEFINES  1
  112. #endif
  113.  
  114. /* function prototypes */
  115. char menu_lotus(int argc, char cmdkey[], char *command[], int col[],
  116.             char *message[], int msglen[], int normal, int highlite,
  117.             int cmdrow, boolean clockon, int clockrow, int clockcol, int clockcolor);
  118.                         /* lotus slash-bar menu */
  119. void lotus_setup(int argc, byte *command[], char cmdkey[], int col[],
  120.                  byte *message[], int msglen[]);
  121.                         /* generates info needed for menu_lotus */
  122.  
  123. struct lotus_header *lotus_alloc(int argc, int cmdrow, char *command[], int cmdkey[],
  124.                                  char cmdflag[], char *message[], struct lotus_clock *clk,
  125.                                  int colnorm, int colcmdkey, int colhilite, int coldisable,
  126.                                  int coldishilite, int colmessage, int defaultcommand,
  127.                                  int spacing, unsigned flags);
  128.  
  129. int menu_popup(int left, int top, int right, int bottom, char frame[],
  130.                char *title, int titlejustify, char *command[], int cmdkey[],
  131.                char cmdflag[], int colframe, int coltitle, int colnorm,
  132.                int colcmdkey, int colhilite, int coldisable, int coldishilite,
  133.                int colnotopt, int defaultcommand, unsigned flags);
  134.  
  135. struct popup_header *popup_alloc(int left, int top, int right, int bottom, char *frame,
  136.                                  char *title, int titlejustify, char *command[], int cmdkey[],
  137.                                  char cmdflag[], int colframe, int coltitle, int colnorm,
  138.                                  int colcmdkey, int colhilite, int coldisable, int coldishilite,
  139.                                  int colnotopt, int defaultcommand, unsigned flags);
  140. int popup_get(struct popup_header *ph);     /* get menu popup choice */
  141. void popup_free(struct popup_header *ph);   /* free memory allocated by popup header */
  142. void popunlite(struct popup_header *ph);
  143. void pophilite(struct popup_header *ph);
  144. int popup_setcurrent(struct popup_header *ph, int current);     /* set current (hilited) item */
  145. void popup_restore(struct popup_header *ph);            /* restore video */
  146.  
  147. struct litebar_header *litebar_alloc(int left, int top, int right, int bottom, char *frame,
  148.                                      char *title, int titlejustify, int count, char *command[], int cmdleft[],
  149.                                      int cmdright[], int cmdup[], int cmddown[], int cmdkey[], char cmdflag[],
  150.                                      int cmdx[], int cmdy[], char *message[], int msgx, int msgy, int argq,
  151.                                      int quitkey[], int colframe, int coltitle, int colnorm, int colcmdkey,
  152.                                      int colhilite, int coldisable, int coldishilite, int colnotopt,
  153.                                      int colmessage, int defaultcommand, unsigned flags);
  154. int litebar_get(struct litebar_header *lh);
  155. void litebar_free(struct litebar_header *lh);
  156. void changelitebar(struct litebar_header *lh, struct litebar_field *lf);
  157. void liteunlite(struct litebar_header *lh);
  158. void litehilite(struct litebar_header *lh);
  159. void litemessage(struct litebar_header *lh, int len);
  160.  
  161. #endif              /* MENUHK_HEADER */
  162.